let express = require('express');
let ejs = require('ejs');
let path = require('path');
let root = process.cwd();
let bodyParser = require('body-parser');
let session = require('express-session')
let { STATIC } = require('./config')
module.exports = app => {
    // 引擎
    app.engine('.html', ejs.__express)
    
    app.use(bodyParser.json())
    
    app.use(session({
        resave: true,
        saveUninitialized: false,
        secret: 'iulove'
    }))
    // 静态化目录
    for(let key in STATIC) {
        app.use(key, express.static(path.join(root, STATIC[key])))
    }
}